var data_nav_b=[
	// 1,0 小米手机
	[
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/d7a15df55e98e4163390096ed05b1ef5.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"Xiaomi 12S Ultra",
			price:"5999元起",
			code:"boxb_first_li"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/b01bb7ee0f8c9865c11eeb2c483015e2.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"Xiaomi 12S Pro",
			price:"4699元起"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/e1f5a30b6e9e29c7f4ad6ed26023f4de.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"Xiaomi 12S",
			price:"3999元起"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/a811f07a4e13510b23ada8e2eca473ae.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"Xiaomi 12 Pro 天玑版",
			price:"3999元起"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/88ae9b85c5f8fbdae2ea98d58a045e1e.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"Xiaomi Civi 1S",
			price:"2299元起"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/02ac31f8d3848f71617e074e8e50879e.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"Xiaomi 12 Pro",
			price:"4699元起"
		}
	],
	// 2,0 Redmi手机
	[
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/1e1f915167554e99916273b5269da1b5.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"Redmi Note 11T Pro+",
			price:"2099元起",
			code:"boxb_first_li"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/f11d7da9517953d11e02d0b459003f19.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"Redmi Note 11T Pro",
			price:"1799元起"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/30969671b2829cbc625f018c6c998708.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"Redmi Note 11SE",
			price:"999元起"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/ae5b5a8e24272dd4cdd77bf6d26954b6.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"Redmi 10A",
			price:"649元起"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/418f4cb7536265cd99bdf8b2e88d1f84.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"Redmi K50 Pro",
			price:"2999元起"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/8725dc0e5b0def0155a219a1fc316cca.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"Redmi K50",
			price:"2399元起"
		}
	],
	// 3,0 电视
	[
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/6511d77270e94146c0b1f96b66d8cc58.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"Redmi智能电视X55 2022",
			price:"2399元",
			code:"boxb_first_li"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/6511d77270e94146c0b1f96b66d8cc58.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"Redmi智能电视X65 2022",
			price:"3099元"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/8871821795310769c1d3896c99b12381.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"小米电视6 65”  OLED",
			price:"6699元"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/0a1ae5341d2dae66cd42566c60d2d666.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"小米电视 大师  77”  OLED",
			price:"17999元"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/932b583c6eccd8aabfa0771f8a854940.jpg?thumb=1&w=200&h=138&f=webp&q=90",
			title:"小米透明电视",
			price:"49999元"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/ea3390a20547c7298a258528e4aa69ad.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"小米电视 大师 65英寸OLED",
			price:"8999元"
		}
	],
	// 4,0 笔记本
	[
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/3f306e56e070eec07b985baf8f1f57e8.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:" Xiaomi Book Pro 14 2022 ",
			price:"6799元起",
			code:"boxb_first_li"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/5cea230383f17c7e87c51b65634381f5.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:" Xiaomi Book Pro 16 2022",
			price:"7399元起",
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/8e638c7da7a9dd5d7a8a215517ca150e.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"RedmiBook Pro 14 2022 锐龙版",
			price:"5299元起",
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/07c66ae36f99daa4d5f613bb3d04ded6.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"RedmiBook Pro 15 2022 锐龙版",
			price:"5499元起",
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/37fcbe3b823c837b6ffe7f59f7aa579e.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"Redmibook Pro 14 锐龙版",
			price:"4699元起",
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/8e638c7da7a9dd5d7a8a215517ca150e.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"Redmi Book Pro 14 2022",
			price:"5399元起",
		}
	],
	// 5,0 平板
	[
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/33de34a4caf2834a1828dc51203dc922.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"小米平板5",
			price:"1849元起",
			code:"boxb_first_li"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/03892b203a6413bcd8ef3f92d77df79c.gif?thumb=1&w=200&h=138&f=webp&q=90",
			title:"小米平板5 Pro 5G",
			price:"3349元"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/aad55902a2cc64bf0306b004adb14ef7.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"小米平板5 Pro",
			price:"2349元起"
		}
	],
	// 6家电
	[
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/cbfab8147c1104eea97c7d0f07581237.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"巨省电 | 米家空调 新一级 1.5匹 睡眠版",
			price:"2388元",
			code:"boxb_first_li"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/4be9f7bb741c25376594976ea5451842.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"巨省电 3匹|变频|新一级能效（鎏金款）",
			price:"5299元"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/65df9e92c06dcd148de5f0eb13e16ea2.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"米家扫拖机器人1T",
			price:"1299元"
		}
	],
	//7 路由
	[
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/c1465737a8a6ac8772560dce2ef0a39f.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"Redmi 电竞路由器 AX5400",
			price:"599元",
			code:"boxb_first_li"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/2a759fa795d749f0538cfd2a15890027.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"小米路由器AX6000",
			price:"549元"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/2815a0a208be362cba673aae9a1f9c93.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"小米路由器AX9000",
			price:"1299元"
		},
		{
			imgurl:"https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/2f88d17e29314286967eeb88bf86cdfc.png?thumb=1&w=200&h=138&f=webp&q=90",
			title:"Xiaomi HomeWiFi 三频 Mesh 路由器",
			price:"1499元"
		},
		{
			imgurl:"https://cdn.cnbj0.fds.api.mi-img.com/b2c-mimall-media/026a28fc18eff2cfa4d26a799a2da9cc.jpg?thumb=1&w=200&h=138",
			title:"小米路由器4A 千兆版",
			price:"129元"
		},
		{
			imgurl:"https://cdn.cnbj0.fds.api.mi-img.com/b2c-mimall-media/2ddc6a2789c5f5ff78fa4ca1402417c8.png?thumb=1&w=200&h=138",
			title:"查看全部<br>小米路由器",
			price:"",
		}
	]
]
var site_header_b=document.getElementsByClassName("site-header-b")[0];
var nav_b_str="",nav_b_str1="";

for(let j=0;j<data_nav_b.length;j++){
	for(let i=0;i<data_nav_b[j].length;i++){
		nav_b_str1+=`
		<li class="boxb_nav_li ${data_nav_b[j][i].code}">
			<a class="boxb_nav_li_a" href="#">
				<div class='boxb_nav_li_img_a'><img class="boxb_nav_li_img" src='${data_nav_b[j][i].imgurl}' alt=""></div>
				<p class="title">${data_nav_b[j][i].title}</p>
				<p class="price">${data_nav_b[j][i].price}</p>
			</a>
		</li>
		`
	}
	nav_b_str+=`<div class="site_header_b_nav"><ul class="clearfix boxb_nav_ul">${nav_b_str1}</ul></div>`;
	nav_b_str1='';
}
site_header_b.innerHTML+=nav_b_str;

(function(){
	// 所有nav2 导航栏2的子元素
	var site_header_b_nav=document.querySelectorAll('.site_header_b_nav');
	// nav2 导航栏选项卡
	var boxbuii_nav_item=document.getElementsByClassName("boxbuii_nav_item");
	var boxb_max=document.getElementsByClassName("site-header-b")[0];
	
	var isok_flag=-1;//离开boxb_max和离开boxbuii_nav_item 清0
	var clear_nav_b=function(n){
		for(let i=0;i<site_header_b_nav.length;i++){
			site_header_b_nav[i].style.display="none";
			site_header_b_nav[i].style.height="0px";
			boxb_max.style.height="0";
			boxb_max.style.borderTop='none';
		}
		if(n>-1){
			isok_flag=n;
			// console.log("有n");
		}
	}
	clear_nav_b();//初始化清空
	var enter=function(data){
		// console.log("进入",data.target.index);
		if(data.target.index>-1){
			lod_index=data.target.index;
			site_header_b_nav[data.target.index].style.height="201px";
			site_header_b_nav[data.target.index].style.display="block";
			boxb_max.style.height="230px";
			boxb_max.style.borderTop='1px solid #e0e0e0';
			
			isok_flag=data.target.index;
		}
		
		
	}
	for(let i=0;i<boxbuii_nav_item.length;i++){
		boxbuii_nav_item[i].index=i;
		boxb_max.onmouseenter=function(){
			if(isok_flag>-1){
				site_header_b_nav[isok_flag].style.height="201px";
				site_header_b_nav[isok_flag].style.display="block";
				boxb_max.style.height="230px";
				boxb_max.style.borderTop='1px solid #e0e0e0';
				// console.log("isok_flag>-1");
			}else{
				// console.log("isok_flag<=-1");
			}
			// console.log("进入大块头");
			
		}
		boxb_max.onmouseleave=function(){
			// console.log("离开大块头");
			isok_flag=-1;
			clear_nav_b();
		}
		boxbuii_nav_item[i].onmouseenter=enter;
		boxbuii_nav_item[i].onmouseleave=function(){
			// console.log("离开");
			clear_nav_b(this.index);
		}
		
	}
	
})()